import 'package:flutter/material.dart';
import 'package:goods_application/util/cascading_dropdown.dart';
// import 'package:goods_application/util/request.dart';

class GoodsShowPage extends StatefulWidget {
  const GoodsShowPage({super.key, required this.title});

  final String title;

  @override
  State<GoodsShowPage> createState() => _GoodsShowPageState();
}

class _GoodsShowPageState extends State<GoodsShowPage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: Text('水平布局示例')),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.spaceEvenly,
          children: [
            SizedBox(height: 150, width: 500, child: CascadingDropdown()),

            // 基本Row
            Row(
              children: [
                Icon(Icons.star, color: Colors.green[500]),
                Icon(Icons.star, color: Colors.green[500]),
                Icon(Icons.star, color: Colors.green[500]),
                Icon(Icons.star, color: Colors.black),
                Icon(Icons.star, color: Colors.black),
              ],
            ),

            // 带间距和对齐的Row
            Row(
              mainAxisAlignment: MainAxisAlignment.spaceBetween,
              children: [Text('左侧'), Text('中间'), Text('右侧')],
            ),

            // 使用Expanded的Row
            Row(
              children: [
                Expanded(
                  flex: 2,
                  child: Container(height: 50, color: Colors.red),
                ),
                Expanded(child: Container(height: 50, color: Colors.blue)),
              ],
            ),

            // 可滚动的Row
            SizedBox(
              height: 50,
              child: SingleChildScrollView(
                scrollDirection: Axis.horizontal,
                child: Row(
                  children: List.generate(
                    20,
                    (i) => Container(
                      width: 80,
                      margin: EdgeInsets.all(4),
                      color: Colors.primaries[i % Colors.primaries.length],
                      child: Center(child: Text('项目 $i')),
                    ),
                  ),
                ),
              ),
            ),
          ],
        ),
      ),
    );
  }
}
